﻿using System.Data.Entity;

namespace IDI.Studio.Client.WinClient.Data
{
    public class DefaultContext : DbContext
    {
        public DefaultContext() : base("DefaultContext") { }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //One<ExchangeRate> to Many<ExchangeRateDetail>
            modelBuilder.Entity<ExchangeRate>().HasMany<ExchangeRateDetail>(e => e.Details).WithRequired(e => e.ExchangeRate).HasForeignKey(e => e.ExchangeRateId);
        }

        //public DbSet<ExchangeRate> DsExchangeRate { get; set; }

        //public DbSet<ExchangeRateDetail> DsExchangeRateDetail { get; set; }
    }
}
